package MyApp::Workflow::Condition::IsAgreeUser;

use strict;
use base qw( Workflow::Condition );
use Workflow::Exception qw ( condition_error );
use Workflow::Factory qw ( FACTORY );
use Log::Log4perl qw( get_logger );
my ($FACTORY);


sub evaluate {
	my ( $self, $wf ) = @_;
    my $log;
    $log = get_logger();

	my $current_user = $wf->context->param('current_user');
	my $db = $wf->context->param('db');
	my $workflow_type = $wf->context->param('workflow_type');

	my $right_user = $db->query('select agree_user from daiban where workflow_id=? and workflow_type=?',$wf->id,$workflow_type)->array->[0];
    $log->debug($right_user);
	unless($right_user =~ /$current_user/) {
		condition_error "shenpirenbudui";
	}
}

1;
